// TOWN SCRIPT
//    Town 1: Ancient Docks

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documentation. States you write
// yourself should be numbered from 10-100.

begintownscript;

variables;

body;

beginstate INIT_STATE;
// Called upon entering]

//intro texttttt
if(get_flag(1,0) == 0) {
	reset_dialog();
	add_dialog_str(0,"You emerge from the forest and into a small clearing. Looking around, the place is silent, damp, and free from any angels.",0);
	add_dialog_str(1,"Up ahead, to the east, you can see a small dock and... you can hardly believe your luck! Tied up to the end of the pier is a rickety-looking, but still-floating boat.",0);
	add_dialog_str(2,"You might finally be able to get off this island and back to civilization.",0);
	run_dialog(1);
	set_flag(1,0,1);
}

break;

beginstate EXIT_STATE;
// Always called when the town is left.
break;

beginstate START_STATE;
// Called every turn.
break;

//Boating house.
beginstate 10;
	if(get_flag(1,1) == 0) {
		message_dialog("This large warehouse used to be where the inhabitants of the island stored boats whilst they were not being used - there are still three stored in here, each one damaged in a different way.","You wonder why, if these people were capable of leaving the island, nobody knew that the place was inhabited? Oh well - that is a question for another time. Right now, you just want to leave this place as soon as you can.");
		set_flag(1,1,1);
	}
break;

//South box
beginstate 12;
	if(get_flag(1,2) == 0) {
		message_dialog("This stone chest is full of threadbare clothes, ratty blankets and broken tools. Needless to say, none of it is of any use to you. You close the chest and move on.","");
		set_flag(1,2,1);
		block_entry(1);
	} else {
		message_dialog("You have already looked in here.","");
		block_entry(1);
	}
break;	

//North box
beginstate 13;
	if(get_flag(1,3) == 0) {
		message_dialog("This stone chest is full of threadbare clothes, ratty blankets and broken tools. Needless to say, none of it is of any use to you. You close the chest and move on.","");
		set_flag(1,3,1);
		block_entry(1);
	} else {
		message_dialog("You have already looked in here.","");
		block_entry(1);
	}
break;	

//Leaving Scen
beginstate 14;
	reset_dialog();
	add_dialog_str(0,"You walk to the end of this old wooden dock, to where the small boat is tied up.",0);
	add_dialog_str(1,"Whilst the boat is small, it looks sturdy enough to take you to the nearest port - it was built well, and the sea has calmed down from when you were shipwrecked here.",0);
	add_dialog_str(2,"Do you wish to leave the island, and the scenario?",0);
	add_dialog_choice(0,"Yes, I'm ready to leave.");
	add_dialog_choice(1,"No, not yet, I want to stay.");
	if(run_dialog(1) == 1) {
		reset_dialog();
		add_dialog_str(0,"You climb inside the boat, and cut the line tying you to the pier. Pushing off, you watch as the island grows further and further away, until finally you turn away and face the way you're going.",0);
        add_dialog_str(1,"Although you know that the Eternal are trapped below the island, you still don't feel comfortable with your back to them. As you row on, you keep your weapons close, not quite sure what you're expecting to happen.",0);
        add_dialog_str(2,"It doesn't take long until you reach a nearby port town. As you climb out of the old wooden craft, you come face to face with a large statue, watching out over the sea. Freezing, you grab your weapons and stare at it.",0);
        add_dialog_str(3,"Panicking, you look around and see that everybody is staring at you. You try to explain but nothing comes out... Slowly, you let your weapons drop from your hands, and slide to the floor, exhausted.",0);
        run_dialog(1);
       
        reset_dialog();
        add_dialog_str(0,"Somebody walks up to you and after helping you to your feet, takes you to a nearby inn. As you sit you begin talking, pouring out everything that happened over the last few days.",0);
        add_dialog_str(1,"As you finish, there is a deathly silence until... somebody starts clapping. The applause spreads, and soon people bring you round after round of drinks, in the hope of getting another story out of you.",0);
        add_dialog_str(2,"Bewildered, you make your excuses and leave, nervously edging your way past a short statue on the way out. You wonder if anybody will ever understand what happened on that island, but you've done all you can.",0);
        add_dialog_str(3,"After a couple of days' rest, you leave the town and go in search of more adventure. As you leave, you watch the statues and remember the mantra you saw on the island: _Don't blink. Don't even blink._",0);
        add_dialog_str(4,"If you could, you'd never blink again.",0);
        run_dialog(1);
        large_draw_pic_dialog(505,"The End."); 
		end_scenario(1);
	} else {
		message_dialog("You don't quite feel ready to leave - after all, there is no rush. The boat has been there for years - a couple more minutes won't hurt.","");
		block_entry(1);
	}
break;